package com.ctrl.riveradministrator.mvp.view.activity.river_doc;


import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.Message;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.ctrl.riveradministrator.R;
import com.ctrl.riveradministrator.base.BaseFragment;
import com.ctrl.riveradministrator.base.BasePresenter;
import com.ctrl.riveradministrator.mvp.model.Drain;
import com.ctrl.riveradministrator.mvp.presenter.DrainPresenter;

import java.util.List;


public class OutfallsFragment extends BaseFragment<DrainPresenter> implements DrainView {

    public static OutfallsFragment INSTANCE;

    private TextView pwkm, sshl, sshd, ssdw, fzr, lxdh, wz, pffs, jd, wd, zywrw, pfzl;

    public static OutfallsFragment newInstance() {
        if (INSTANCE == null) {
            INSTANCE = new OutfallsFragment();
        }
        return INSTANCE;
    }

    public OutfallsFragment() {
    }


    @Override
    protected int bindLayout() {
        return R.layout.fragment_outfalls;
    }

    @Override
    protected void initView(View view) {
        pwkm = $(view, R.id.pwkm);
        sshl = $(view, R.id.sshl);
        sshd = $(view, R.id.sshd);
        ssdw = $(view, R.id.ssdw);
        fzr = $(view, R.id.fzr);
        lxdh = $(view, R.id.lxdh);
        wz = $(view, R.id.wz);
        pffs = $(view, R.id.pffs);
        jd = $(view, R.id.jd);
        wd = $(view, R.id.wd);
        zywrw = $(view, R.id.zywrw);
        pfzl = $(view, R.id.pfzl);
    }

    @Override
    protected void doBusiness(Context mContext, Activity activity) {
        mPresenter.getDrains(RiverDocActivity.riverInfo.getId());
    }

    @Override
    protected void widgetClick(View view) {

    }

    @Override
    protected void setListener() {

    }

    @Override
    public void handleMessage(Message message, int what) {

    }

    @Override
    protected DrainPresenter createPresenter() {
        return new DrainPresenter(this);
    }


    @Override
    public void showMessage(Drain drain) {
        pwkm.setText(drain.getName());
        sshl.setText(drain.getRiverId());
        sshd.setText(drain.getReachId());
        ssdw.setText(drain.getSection());
        fzr.setText(drain.getPrincipal());
        lxdh.setText(drain.getTele());
        wz.setText(drain.getPlace());
        pffs.setText(drain.getWay());
        jd.setText(drain.getLongitude());
        wd.setText(drain.getLatitude());
        zywrw.setText(drain.getKeyPollutant());
        pfzl.setText(drain.getEmissionConcentration());
    }
}
